<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- 舊版的fOrder部署查詢畫面 -->
<link href="css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css">					<!-- zTree CSS函式庫 -->
<link href="css/redmond/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" type="text/css">	<!-- jquery UI CSS函式庫 -->
<link href="css/selfTemplate.css" rel="stylesheet" type="text/css">							<!-- 自建CSS函式庫 -->

<script src="js/jquery-1.10.2.min.js" type="text/javascript"></script>								<!-- jquery 函式庫 -->
<script src="js/jquery-ui-1.10.3.custom.js" type="text/javascript"></script>					<!-- jquery UI 函式庫 -->
<script src="js/jquery.cookie.js" type="text/javascript"></script>								<!-- 操做cookie用 -->
<script src="js/widgets.js" type="text/javascript"></script>									<!-- 自建函式庫 -->


<style type="text/css">
	div#mainDiv {
		width: 80%; 
		padding-top:20px;
		padding-buttom:20px; 
		padding-right:20px;
		padding-left:15px; 
		
	}
</style>

<script type="text/javascript">

function formatNumber(n) {
    n += "";
    var arr = n.split(".");
    var re = /(\d{1,3})(?=(\d{3})+$)/g;
    return arr[0].replace(re,"$1,") + (arr.length == 2 ? "."+arr[1] : "");
}

$(document).ready(function(){
	
	init("QueryDephistory.html");
	
	
	$("#btnSubmit").bind("click", function(){
		clearErrorMsg();
	/* 	windowFreeze();
		 */
		$.ajax({ type:'post',url:"QueryDepRecordParis",dataType:'json',async:false,
			success : function(reses) {
				if ( reses.length > 0 ) {
					$("#queResRoot").html("<table id='tableQueryDepParis'><thead class='tableFirst'><tr><th>上線序號</th><th>檔名</th><th>版本</th><th>檔案大小</th><th>執行時間</th><th>執行主機</th><th>執行帳號</th><th>執行動作</th><th>部署結果</th><th>緊急上線</th><th>交付序號</th></tr><tbody id='tbodyQueryDepParis'></tbody></table>");
					
					var preSN = 0;
					
					$.each(reses, function(i,res) {
						
						var tmp = "";
						var bgc = (i%2==1)?"#EAF4FD":"white";
						
						if( preSN != res.depmainSN ) {
							tmp = "<tr title='"+res.depResult+"' bgcolor='"+bgc+"'><td class='int tdr"+res.depmainSN+"'>"+res.depmainSN+"</td><td class='engN right'>"+res.depFN+"</td><td class='int'>"+(res.localVer==0?"":res.localVer)+"</td><td class='int'>"+(res.fileSizeInByte==0?"":formatNumber(res.fileSizeInByte))+"</td><td class='engN left'>"+res.eDT+"</td><td class='left engN'>"+res.hostIP+"</td><td>"+res.empName+"</td><td>"+res.actTypeDesc+"</td><td>&nbsp;</td><td>否</td><td class='int'>"+res.deliverySN+"</td></tr>";
							preSN = res.depmainSN;
						} else {
							tmp = "<tr title='"+res.depResult+"' bgcolor='"+bgc+"'><td class='engN right'>"+res.depFN+"</td><td class='int'>"+(res.localVer==0?"":res.localVer)+"</td><td class='int'>"+(res.fileSizeInByte==0?"":formatNumber(res.fileSizeInByte))+"</td><td class='engN left'>"+res.eDT+"</td><td class='left engN'>"+res.hostIP+"</td><td>"+res.empName+"</td><td>"+res.actTypeDesc+"</td><td>&nbsp;</td><td>否</td><td class='int'>"+res.deliverySN+"</td></tr>";
						}
						$("#tbodyQueryDepParis").append(tmp);
						
						$(".tdr"+res.depmainSN).attr("rowspan",res.rowspan);
					});
					
					$("#tbodyQueryDepParis").tooltip(); 
					
				} else {
					$("#queResRoot").html("");
					$("#errShortMsg").html("沒有查詢到結果");
				}
			}, error : function(xhr, ajaxOptions, thrownError) { errorAjx(xhr); }
		});
		
/* 		windowUnfreeze(); */
	});
	
	$("button").button();
});

</script>
</head>
<body>
	<div id="header"></div>		<!-- 畫面抬頭 -->

	<div id="mainDiv" >
		<table id="tableQueryCriDepMemphis">
			<thead class="tableFirst">
				<!-- <tr><th class="right">預設查詢天數</th><td><input size="2" class="int" value="15" type="text" id="queryInterval" />天內</td></tr> -->
				<tr><td class="center" colspan="2"><button id="btnSubmit" type="button">送出</button></td></tr>
				<tr><td colspan="2">&nbsp;</td></tr>
			</thead>
		</table>
		<p>
		<div id="queResRoot"></div>
	</div>
	<p><p>
</body>
</html>